package jweslley.ProblemSetVolumes.VolumeI;

import static java.lang.Math.max;
import static java.lang.Math.min;

import java.util.Scanner;

import jweslley.Problem;
import jweslley.Problem.Status;

/**
 * http://icpcres.ecs.baylor.edu/onlinejudge/external/1/100.html
 *
 * @author  Jonhnny Weslley
 * @version 1.00, 15/10/2008
 */
@Problem(Status.Accepted)
public class ThreeNPlusOne {

	static int[] cache = new int[1000000];
	
	private static int cycleLength(int n) {
		int count = 1;
		while (n > 1) {
			if (n < 1000000 && cache[n] != 0) {
				count += cache[n] - 1;
				return count;
			}
			n = ((n & 1) != 0) ? 3 * n + 1 : n >> 1;
			count++;
		}
		return count;
	}

	public static void main(String[] args) {
		StringBuilder out = new StringBuilder();
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int a = in.nextInt();
			int b = in.nextInt();
			in.nextLine();
			int max = max(a, b);
			int min = min(a, b);
			int value = 0;
			for (int i = min; i <= max; i++) {
				if (cache[i] == 0) {
	                cache[i] = cycleLength(i);
	            }
				if (value < cache[i]) {
					value = cache[i];
				}
			}
			out
			.append(min).append(' ')
			.append(max).append(' ')
			.append(value).append('\n');
		}
		System.out.print(out);
	}

}
